//
//  PhoneTextFieldView.m
//  JunZeWristband
//
//  Created by Kendama on 2017/8/16.
//  Copyright © 2017年 DT. All rights reserved.
//

#import "PhoneTextFieldView.h"

@implementation PhoneTextFieldView

- (instancetype)init
{
    self = [super init];
    if (self)
    {
        [self masLayoutSubviews];
        
    }
    return self;
}


- (UITextField *)phoneTextField
{
    if(!_phoneTextField)
    {
        UIView *superView = self;
        _phoneTextField = [[UITextField alloc]init];
        _phoneTextField.font = [UIFont systemFontOfSize:15];
//        _phoneTextField.keyboardType = UIKeyboardTypeEmailAddress;
        [superView addSubview:_phoneTextField];
    }
    return _phoneTextField;
}

- (UIImageView *)iconImageView
{
    if(!_iconImageView)
    {
        UIView *superView = self;
        _iconImageView = [[UIImageView alloc]init];
        [superView addSubview:_iconImageView];
        _iconImageView.contentMode = UIViewContentModeCenter;
    }
    return _iconImageView;
}

- (UIView *)line
{
    if(!_line)
    {
        UIView *superView = self;
        _line = [[UIView alloc]init];
        [superView addSubview:_line];
        _line.backgroundColor = [UIColor colorWithWhite:0.95 alpha:1];
    }
    return _line;
}



- (void)masLayoutSubviews{
    __weak UIView *superView = self;
    [self.line mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(superView).with.offset(px1080Width(50));
        make.right.equalTo(superView).with.offset(px1080Width(-50));
        make.height.mas_equalTo(1);
        make.bottom.mas_equalTo(superView.mas_bottom);
    }];
    
    [self.iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(superView.mas_centerY);
        make.left.mas_equalTo(self.line.mas_left);
        make.width.height.mas_equalTo(px1080Width(60));
    }];
    
    [self.phoneTextField mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.iconImageView.mas_right).with.offset(px1080Width(35));
        make.centerY.equalTo(self.iconImageView);
        make.height.mas_equalTo(px1920Height(70));
        make.right.mas_equalTo(self.line.mas_right);
    }];
    
}

@end
